using UnityEngine;

public class PlayerSpawner : MonoBehaviour
{
	public Vector3 Offset = Vector3.up;

	private void OnDrawGizmos()
	{
	}

	public Vector3 SpawnPoint()
	{
		Vector3 position = base.transform.position;
		Vector3 localScale = base.transform.localScale;
		int min = -(int)(localScale.x / 2f);
		Vector3 localScale2 = base.transform.localScale;
		float x = UnityEngine.Random.Range(min, (int)(localScale2.x / 2f));
		Vector3 localScale3 = base.transform.localScale;
		int min2 = -(int)(localScale3.z / 2f);
		Vector3 localScale4 = base.transform.localScale;
		return DetectGround(position + new Vector3(x, 0f, UnityEngine.Random.Range(min2, (int)(localScale4.z / 2f))));
	}

	private Vector3 DetectGround(Vector3 position)
	{
		if (Physics.Raycast(position, -Vector3.up, out RaycastHit hitInfo, 1000f))
		{
			return hitInfo.point + Offset;
		}
		return position;
	}
}
